package com.spring.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @author ZhuYouBin
 * @version 1.0.0
 * @Date: 2022/9/10 11:52
 * @Description
 */
@Controller
@RequestMapping("/freemarker")
public class FreemarkerController {

    @RequestMapping("/index")
    public String index(HttpServletRequest request) {
        request.setAttribute("freeMarker", "Freemarker");
        // 这里返回视图名称，SpringMVC 就会拼接前缀和后缀
        // 变成: /WEB-INF/pages/pre_index.ftl
        return "index";
    }
}
